/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/database/SysContacts.h,v 1.3 2003/11/21 12:39:24 itsme Exp $
 *
 *
 */


#ifndef __SYSCONTACTS_H__

#include <windows.h>
#include "CeDatabase.h"

class SysContactsEntry {
public:
   const TCHAR *name;
   const TCHAR *number;
   const TCHAR *numbertype;
};

class SysContacts {
public:
    SysContacts();
    ~SysContacts();

    void Open();

    bool FindEntryByNumber(const TCHAR *number, SysContactsEntry &entry);
    void AddEntry(const SysContactsEntry &entry);
    bool AddDataCallEntry(const WCHAR *wnumber);
    bool FindPreferredNumber(CEOID oid, WCHAR *wnumber, int maxnumlen);

private:
        CeDatabase m_db;

        // buffer to avoid dynamic memory allocs - should use std::string 
        // instead, to avoid problem all together
        TCHAR m_nrbuf[64];

    WCHAR *DatabaseName();
};


// unless noted otherwise these are all string fields.
enum DBSYSCONTACTS_FIELDS {
    DBSYSCONTACT_UNKNOWN_0016       = FIELDID(0x0016, CEVT_BLOB),
    DBSYSCONTACT_NOTES              = FIELDID(0x0017, CEVT_BLOB),
    DBSYSCONTACT_NAME_SUFFIX        = FIELDID(0x3a05, CEVT_LPWSTR),
    DBSYSCONTACT_NAME_FIRSTNAME     = FIELDID(0x3a06, CEVT_LPWSTR), 
    DBSYSCONTACT_TEL_WORK           = FIELDID(0x3a08, CEVT_LPWSTR), 
    DBSYSCONTACT_TEL_HOME           = FIELDID(0x3a09, CEVT_LPWSTR), 
    DBSYSCONTACT_NAME_LASTNAME      = FIELDID(0x3a11, CEVT_LPWSTR), 
    DBSYSCONTACT_JOB_COMPANY        = FIELDID(0x3a16, CEVT_LPWSTR), 
    DBSYSCONTACT_JOB_TITLE          = FIELDID(0x3a17, CEVT_LPWSTR), 
    DBSYSCONTACT_JOB_DEPARTMENT     = FIELDID(0x3a18, CEVT_LPWSTR), 
    DBSYSCONTACT_JOB_OFFICE_LOC     = FIELDID(0x3a19, CEVT_LPWSTR), 
    DBSYSCONTACT_TEL_MOBILE         = FIELDID(0x3a1c, CEVT_LPWSTR), 
    DBSYSCONTACT_TEL_RADIO          = FIELDID(0x3a1d, CEVT_LPWSTR), 
    DBSYSCONTACT_TEL_CAR            = FIELDID(0x3a1e, CEVT_LPWSTR), 
    DBSYSCONTACT_TEL_WORK_FAX       = FIELDID(0x3a24, CEVT_LPWSTR), 
    DBSYSCONTACT_TEL_HOME_FAX       = FIELDID(0x3a25, CEVT_LPWSTR), 
    DBSYSCONTACT_TEL_HOME2          = FIELDID(0x3a2f, CEVT_LPWSTR), 
    DBSYSCONTACT_BIRTHDAY           = FIELDID(0x4001, CEVT_FILETIME),
    DBSYSCONTACT_JOB_ASSISTANT      = FIELDID(0x4002, CEVT_LPWSTR), 
    DBSYSCONTACT_ANNIVERSARY        = FIELDID(0x4003, CEVT_FILETIME),
    DBSYSCONTACT_TEL_ASSISTANT      = FIELDID(0x4004, CEVT_LPWSTR), 
    DBSYSCONTACT_CHILDREN           = FIELDID(0x4006, CEVT_LPWSTR), 
    DBSYSCONTACT_TEL_WORK2          = FIELDID(0x4007, CEVT_LPWSTR), 
    DBSYSCONTACT_HOME_PAGE          = FIELDID(0x4008, CEVT_LPWSTR), 
    DBSYSCONTACT_TEL_PAGER          = FIELDID(0x4009, CEVT_LPWSTR), 
    DBSYSCONTACT_SPOUSE             = FIELDID(0x400a, CEVT_LPWSTR), 
    // FIELDID(0x4010, CEVT_LPWSTR)  "YomiLastName"
    // FIELDID(0x4011, CEVT_LPWSTR)  "YomiFirstName"
    // FIELDID(0x4012, CEVT_LPWSTR)  "YomiCompanyName"
    DBSYSCONTACT_NAME_FULL          = FIELDID(0x4013, CEVT_LPWSTR), 
    DBSYSCONTACT_NAME_TITLE         = FIELDID(0x4023, CEVT_LPWSTR), 
    DBSYSCONTACT_NAME_MIDDLE        = FIELDID(0x4024, CEVT_LPWSTR), 
    DBSYSCONTACT_HOME_ADDR          = FIELDID(0x4040, CEVT_LPWSTR), 
    DBSYSCONTACT_HOME_CITY          = FIELDID(0x4041, CEVT_LPWSTR), 
    DBSYSCONTACT_HOME_STATE         = FIELDID(0x4042, CEVT_LPWSTR), 
    DBSYSCONTACT_HOME_ZIP           = FIELDID(0x4043, CEVT_LPWSTR), 
    DBSYSCONTACT_HOME_COUNTRY       = FIELDID(0x4044, CEVT_LPWSTR), 
    DBSYSCONTACT_WORK_ADDR          = FIELDID(0x4045, CEVT_LPWSTR), 
    DBSYSCONTACT_WORK_CITY          = FIELDID(0x4046, CEVT_LPWSTR), 
    DBSYSCONTACT_WORK_STATE         = FIELDID(0x4047, CEVT_LPWSTR), 
    DBSYSCONTACT_WORK_ZIP           = FIELDID(0x4048, CEVT_LPWSTR), 
    DBSYSCONTACT_WORK_COUNTRY       = FIELDID(0x4049, CEVT_LPWSTR), 
    DBSYSCONTACT_OTHER_ADDR         = FIELDID(0x404a, CEVT_LPWSTR), 
    DBSYSCONTACT_OTHER_CITY         = FIELDID(0x404b, CEVT_LPWSTR), 
    DBSYSCONTACT_OTHER_STATE        = FIELDID(0x404c, CEVT_LPWSTR), 
    DBSYSCONTACT_OTHER_ZIP          = FIELDID(0x404d, CEVT_LPWSTR), 
    DBSYSCONTACT_OTHER_COUNTRY      = FIELDID(0x404e, CEVT_LPWSTR), 
    DBSYSCONTACT_EMAIL_1ST          = FIELDID(0x4083, CEVT_LPWSTR), 
    DBSYSCONTACT_EMAIL_2ND          = FIELDID(0x4093, CEVT_LPWSTR), 
    DBSYSCONTACT_EMAIL_3RD          = FIELDID(0x40a3, CEVT_LPWSTR), 
    DBSYSCONTACT_UNKNOWN_FFFD       = FIELDID(0xfffd, CEVT_UI4),
    DBSYSCONTACT_UNKNOWN_FFFE       = FIELDID(0xfffe, CEVT_UI4),
};



#define __SYSCONTACTS_H__
#endif
